package com.dk.service.impl;

import com.dk.mapper.MdItemMapper;
import com.dk.pojo.MdItem;
import com.dk.pojo.MdItemExample;
import com.dk.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author LTZ
 * @create 2023/5/11
 */
@Service
public class ItemServiceImpl implements ItemService {

    @Autowired
    private MdItemMapper itemMapper;

    @Override
    public MdItem selectByItemCode(String itemCode) {
        MdItemExample example = new MdItemExample();
        example.createCriteria().andItemCodeEqualTo(itemCode);
        List<MdItem> items = itemMapper.selectByExample(example);
        return items.size() > 0 ? items.get(0): null;
    }
}